// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WebInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the WebInfo type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Serialization;
    using System.Collections.Generic;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(
        Title = "Web Part Zone Information",
        ReleaseStatus = ReleaseStatus.Development,
        Summary = "Defines a set of parameters for a SharePoint web part and zone."
        )
    ]
    public class WebPartZoneInfo : WSSEntityBase
    {
        private List<Microsoft.SharePoint.WebPartPages.WebPart> webParts;

        private string zoneId;

        private bool? clearZone;

        private PersonalizationScope personalizationScope;

        [CollaborisProperty(
             Summary = "Specifies a list of web parts to be added to the web part zone, specified in the 'ZoneId' property.",
             Title = "Web Parts List",
             Example = @"<list element-type=""Microsoft.SharePoint.WebPartPages.WebPart, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"">
						    <object id=""ProviderWebPart1"" type=""Microsoft.SharePoint.Portal.WebControls.SPSlicerTextWebPart, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"">
							    <property name=""FilterName"" value=""Some Filter name""/>
							    <property name=""Title"" value=""Provider""/>
							    <property name=""ID"" value=""provider""/>
						    </object>
                         </list>",
             SerializedExample = "$(MSBuildProperyThatCanResolveToAListOfWebParts)",
             InputHint = InputHint.ObjectCollection,
             Required = true)]
        public List<Microsoft.SharePoint.WebPartPages.WebPart> WebParts
        {
            get
            {
                return webParts;
                
            }
            set
            {
                webParts = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies the ID (as a string) of the web part zone to add the web parts to.",
             Title = "Zone Id",
             Example = "WebPartZone1",
             InputHint = InputHint.SingleText,
             Required = true)]
        public string ZoneId
        {
            get
            {
                return zoneId;
            }
            set
            {
                zoneId = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies whether to clear (delete) <b>all</b> web parts from " + 
                       "the zone prior to adding. (Choose to do this if updating).",
             Title = "Clear Zone",
             Example = "true",
             InputHint = InputHint.Boolean,
             Required = false)]
        [XmlElement(IsNullable = true)]
        public bool? ClearZone
        {
            get
            {
                return this.clearZone;
            }
            set
            {
                this.clearZone = value;
            }
        }

        [CollaborisProperty(
            Summary = "Indicates the PersonalizationScope for a WebPartManager " +
                       "object or the PersonalizationScope that applies to a " +
                       "property on a web parts control.",
            Title = "Personalization Scope",
            Example = @"Shared",
            Remarks = "Possible values are 'Shared' or 'User'.",
            InputHint = InputHint.Enum,
            Required = true)]
        public PersonalizationScope PersonalizationScope
        {
            get
            {
                return personalizationScope;
            }
            set
            {
                personalizationScope = value;
            }
        }
    }
}   